package main.war.city;

import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;

import main.war.city.building.Loc;

public class City {
	private final Location core;
	private final World world;
	private int level;
	private Player master;
	private CityScopeDetect detect;
	private CityScopeDomain domain;
	public City(World world,Location l,int level){
		this.core = l;
		this.level = level;
		this.world = world;
		detect = new CityScopeDetect(this,0);
		domain = new CityScopeDomain(this,0);
//		master =
	}
	public void setBuildingInCity(Loc l){
		
	}
	public void loadBuilding(){
		
	}
	public void creaftBuilding(){
		
	}
	public CityScopeDetect getDetect(){
		return detect;
	}
	public CityScopeDomain getDomain(){
		return domain;
	}
//	public City(Player p){
//		master =p;
//	}
	public World getWorld(){
		return world;
	}
	public Location getCore(){
		return this.core;
	}
	public int getLevel(){
		return this.level;
	}
	
	enum situation{
		NORMAL,ALERT,WAR;
	}
	@Override
	public int hashCode(){ 
		return core.hashCode()+level*7;
	}
	@Override
	public boolean equals(Object o){
		if(o==null)return false;
		if(o instanceof City)return false;
		City c=(City) o;
		if(c.getCore().equals(core)&&c.getLevel()==level)
			return true;
		return false;
	}
	public Player getMaster(){
		return master;
	}
}
